package com.project.running.Service.Impl;

import com.project.running.Service.PointrecordService;

import com.project.running.bean.Pointrecord;
import com.project.running.dao.PointrecordMapper;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/10/6-10-06-20:23
 * @Description：com.project.running.Service.Impl
 */

@Service
public class PointrecordServiceImpl implements PointrecordService {

    @Autowired
    PointrecordMapper mapper;
    @Override
    public Pointrecord getPointreCordByPoint(Long point) {
//        SqlSession session = SqlSessionUtil.openSession();
//        PointrecordMapper mapper = session.getMapper(PointrecordMapper.class);
//        try{
//
//            return mapper.selectByPrimaryKey(point);
//        }finally {
//            session.close();
//        }
        return mapper.selectByPrimaryKey(point);
    }

    @Override
    public int getVisitNum() {
//        SqlSession session = SqlSessionUtil.openSession();
//        PointrecordMapper mapper = session.getMapper(PointrecordMapper.class);
//
//        try{
//            return mapper.getVisitNum();
//        }finally {
//            session.close();
//        }
        return mapper.getVisitNum();
    }
}
